﻿#pragma once


#include <QDialog>
#include <QPushButton>
#include "QListView"
#include "QStringListModel"
#include "QFileDialog"
#include "QMessageBox"
#include "QApplication"
#include "QVBoxLayout"
#include <QDesktopWidget>
#include <QLibrary>
#include <QApplication>
#include <QLabel>
#include <QComboBox>
#include "QListView"
#include "QStringListModel"
#include "QLineEdit"
#include "QSpinBox"
#include "QRadioButton"
#include <QSettings>

#include "commonfunction.h"


#include "halcon_opencv.h"

using namespace std;

#include "qt_graphics_view_image.h"
#include "qt_graphics_shape_rectangle.h"

#include "qwidget_dl_para1.h"




class FunctionFrankWidth :public QDialog
{
public:



    QSettings* m_qsettings;
    QString m_section   = "";
	QString m_save_image_dir;
	bool m_state = false;
     
    MyQGraphicsView* m_view ;

    QLabel* m_qlabel_width_min;
    QSpinBox* m_qspinbox_width_min;
    int m_width_min = 0;

    QLabel* m_qlabel_width_max;
    QSpinBox* m_qspinbox_width_max;
    int m_width_max = 10000;


    QPushButton* m_pushbutton_show_orign_image;
    QPushButton* m_pushbutton_detection;
    QPushButton* m_pushbutton_save_parameter;
    QPushButton* m_pushbutton_return;

    QLabel* m_qlabel_message;

    int m_result;

    QLabel* m_qlabel_row1=new QLabel();
    QLabel* m_qlabel_column1 = new QLabel();
    QLabel* m_qlabel_row2 = new QLabel();
    QLabel* m_qlabel_column2 = new QLabel();

    QSpinBox* m_qpinbox_row1 = new QSpinBox(this);
    QSpinBox* m_qpinbox_column1 = new QSpinBox(this);
    QSpinBox* m_qpinbox_row2 = new QSpinBox(this);
    QSpinBox* m_qpinbox_column2 = new QSpinBox(this);





    int row1, column1, row2, column2;
    int ret;


    Mat m_image;
    Mat m_show_image;

    HObject m_hobject_show;
public:
    explicit FunctionFrankWidth(QDialog *parent = nullptr, QSettings* qsettings = nullptr,QString section="") ;
    ~FunctionFrankWidth() ;
    virtual void detectionImage();
    int detection(HObject image, QString& message);
	void draw(Mat image_in,Mat& image_out);
    virtual void loadParameter();
    virtual void saveParameter();
    virtual bool showDialog();
};
#pragma execution_character_set("utf-8")
